Skip to main content

Python

Getting started with Python

To use the API with Python use the following example

Using http.client

    import http.client
import json

conn = http.client.HTTPSConnection("apiv1.pataa.com")
payload = json.dumps({
"api_key": "777XXXXXXXXXXXXXXXXXXXAWVwNpSM=",
"pc": "HOME006"
})
headers = {
'Content-Type': 'application/json'
}
conn.request("POST", "/prt-pc-dtl", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))

Using Python Request

    import requests
import json

url = "https://apiv1.pataa.com/get-pataa"

payload = json.dumps({
"api_key": "777XXXXXXXXXXXXXXXXXXXAWVwNpSM=",
"pc": "HOME006"
})
headers = {
'Content-Type': 'application/json'
}

response = requests.request("POST", url, headers=headers, data=payload)

print(response.text)